package cn.zz.camerasdk.filter;

import android.opengl.GLES20;

/**
 * author: zhu on 2017/7/11 11:54
 * email: mackkill@gmail.com
 */

public class GPUImageMixBlendFilter extends GPUImageTwoInputFilter {
    private int mMixLocation;
    private float mMix;

    public GPUImageMixBlendFilter(String fragmentShader) {
        this(fragmentShader, 0.5F);
    }

    public GPUImageMixBlendFilter(String fragmentShader, float mix) {
        super(fragmentShader);
        this.mMix = mix;
    }

    public void onInit() {
        super.onInit();
        this.mMixLocation = GLES20.glGetUniformLocation(this.getProgram(), "mixturePercent");
    }

    public void onInitialized() {
        super.onInitialized();
        this.setMix(this.mMix);
    }

    public void setMix(float mix) {
        this.mMix = mix;
        this.setFloat(this.mMixLocation, this.mMix);
    }
}
